package ace.module.account.api.model.input.account;

import ace.cmp.core.utils.RegPatternUtils;
import ace.module.account.api.enums.IamAccountProfileRegisterSourceFromEnum;
import ace.module.account.api.enums.IamAccountProfileSexEnum;
import ace.module.account.api.enums.IamAccountStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = "管理员账户新增编辑参数")
public class IamAdminAccountAdminSaveInput implements Serializable {

  @Schema(title = "id")
  private Long id;

  @Size(max = 255)
  @Pattern(regexp = RegPatternUtils.REG_USERNAME_FORMAT)
  @NotEmpty
  @Schema(title = "账户名", description = "4至50位密码,支持内容：a-zA-Z0-9_-@.", requiredMode = RequiredMode.REQUIRED)
  private String username = "";

  @Schema(title = "是否需要更改密码", description = "默认:false")
  private Boolean passwordChangeRequired = false;

  @Builder.Default
  @Pattern(regexp = RegPatternUtils.REG_USERNAME_FORMAT)
  @Size(min = 6, max = 36)
  @Schema(title = "密码", description = "6至50位密码,支持内容：a-zA-Z0-9!@#$%^&*()-=_+,可选：空值密码不进行修改", requiredMode = RequiredMode.NOT_REQUIRED)
  private String password = "";

  @Max(value = 2)
  @Min(value = 1)
  @Schema(title = "状态", description = "1-正常 2-锁定 默认:正常")
  private Integer status = IamAccountStatusEnum.NORMAL.getCode();


  @Size(max = 255)
  @Schema(title = "头像", description = "")
  private String avatar = "";


  @PositiveOrZero
  @Schema(title = "生日时间戳", description = "毫秒 默认:0")
  private Long birthday = 0L;

  /**
   * {@link IamAccountProfileSexEnum}
   */
  @Max(value = 3)
  @Min(value = 1)
  @Schema(title = "性别", description = "1-未知 2-男性 3-女性 默认:1")
  private Integer sex = IamAccountProfileSexEnum.UNKNOWN.getCode();

  @Size(max = 255)
  @Schema(title = "签名", description = "")
  private String signature = "";


  @Size(max = 255)
  @Schema(title = "联系方式", description = "")
  private String contactInfo = "";

  @Size(max = 255)
  @Schema(title = "昵称", description = "")
  private String nickName = "";

  @Size(max = 255)
  @Schema(title = "真实姓名", description = "")
  private String realName = "";

  /**
   * 注册来源 {@link IamAccountProfileRegisterSourceFromEnum}
   */
  @Max(value = 5)
  @Min(value = 0)
  @Schema(title = "注册来源", description = "1-未知 2-电脑浏览器端 3-手机浏览器端 4-微信公众号 5-微信小程序 6-ios 7-android 默认:1")
  private Integer registerSourceFrom = IamAccountProfileRegisterSourceFromEnum.UNKNOWN.getCode();

  @Schema(title = "账户所属角色", description = "")
  private List<Long> roleIds = new ArrayList<>();

  @Schema(title = "账户所属组织", description = "")
  private List<Long> orgIds = new ArrayList<>();
}
